//
//  DDateAnalysisSectionDateView.swift
//  Drop
//
//  Created by hushaohua on 2018/4/6.
//  Copyright © 2018年 init. All rights reserved.
//

import UIKit


class DDateAnalysisSectionDateView: UITableViewHeaderFooterView {
    override init(reuseIdentifier: String?) {
        super.init(reuseIdentifier: reuseIdentifier);
        self.contentView.addSubview(self.dateLabel);
        self.addSubviewConstraints();
    }
    
    lazy var dateLabel:UILabel = {
        var label:UILabel = UILabel(frame: .zero);
        label.translatesAutoresizingMaskIntoConstraints = false;
        label.textColor = UIColor.darkGray;
        label.font = UIFont.systemFont(ofSize: 16, weight: .light);
        return label;
    }();
    
    func addSubviewConstraints() -> Void{
        var constraints:[NSLayoutConstraint] = [NSLayoutConstraint]();
        let views:[String : Any] = ["date" : self.dateLabel];
        constraints += NSLayoutConstraint.constraints(withVisualFormat: "H:|-30-[date]", options: .directionLeadingToTrailing, metrics: nil, views: views);
        
        constraints += NSLayoutConstraint.constraints(withVisualFormat: "V:|-0-[date]-0-|", options: .directionLeadingToTrailing, metrics: nil, views: views);
        
        NSLayoutConstraint.activate(constraints);
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
